package com.gct.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import com.gct.domain.Album;
import com.gct.domain.Art;
import com.gct.persistence.AlbumMapper;
import com.gct.service.base.BaseService;

@Service
public class AlbumService extends BaseService {
    @Autowired
    private AlbumMapper albumMapper;

    public List<Album<Art>> topAlbums() {
       return albumMapper.topAlbums();
    }

    public List<Album<Art>> getAlbums() {
        return albumMapper.getAlbums();
     }

    public Album<Art> artsInAlbum(long albumId) {
        return albumMapper.getArtsInAlbum(albumId);
     }

    @Transactional(isolation=Isolation.READ_COMMITTED, rollbackFor=Throwable.class)
    public void saveAlbum(Album<Art> album) {
        albumMapper.saveAlbum(album);
    }
}
